#! /usr/bin/env python
# -*- coding: utf-8 -*-
# __author__ = "Dylan"


from flask import Flask
from flask_sqlalchemy import SQLAlchemy
# from flask_wtf.csrf import CSRFProtect

db = SQLAlchemy()


def create_app():
    app = Flask(__name__, instance_relative_config=True)
    app.config.from_pyfile('config.py', silent=True)

    from myApp.home import home
    from myApp.admin import admin
    app.register_blueprint(home)
    app.register_blueprint(admin)

    # csrf = CSRFProtect()
    # csrf.init_app(app)
    db.init_app(app)

    return app
